<template>
    <div>
      <operation-title
        title="搜索框"
        :icon="TitleIcon"
      />
        <div class="divider"></div>
        <div class="func">
            <p class="attr">样式</p>
            <ul class="common-ul">
                <li @click="config.pageConfig.style = '1'" :class="config.pageConfig.style == '1' ? 'active' : ''">
                    默认
                </li>
                <li @click="config.pageConfig.style = '2'" :class="config.pageConfig.style == '2' ? 'active' : ''">
                    投影
                </li>
                <li @click="config.pageConfig.style = '3'" :class="config.pageConfig.style == '3' ? 'active' : ''">
                    描边
                </li>
            </ul>
            <div class="adjust-item" v-if="config.pageConfig.style == '3'">
                <el-color-picker v-model="config.pageConfig.borderColor" />
                <span>{{ config.pageConfig.borderColor }}</span>
            </div>
            <div class="adjust-item" v-if="config.pageConfig.style == '3'">
                <el-slider v-model="config.pageConfig.borderWidth" :min="0" :max="5" show-input size="small" />px
            </div>
        </div>
        <div class="divider"></div>
        <div class="func">
            <p class="attr">颜色设置</p>
            <div class="adjust-item">
                <span>底部背景</span>
                <el-color-picker v-model="config.pageConfig.color" />
                <span>{{ config.pageConfig.color }}</span>
            </div>
            <div class="adjust-item">
                <span>组件背景</span>
                <el-color-picker v-model="config.pageConfig.componentColor" />
                <span>{{ config.pageConfig.componentColor }}</span>
            </div>
            <div class="adjust-item">
                <span>图标颜色</span>
                <el-color-picker v-model="config.pageConfig.iconColor" />
                <span>{{ config.pageConfig.iconColor }}</span>
            </div>
            <div class="adjust-item">
                <span>文字颜色</span>
                <el-color-picker v-model="config.pageConfig.textColor" />
                <span>{{ config.pageConfig.textColor }}</span>
            </div>
        </div>
        <div class="func">
            <p class="attr">文字位置</p>
            <ul class="common-ul">
                <li @click="config.pageConfig.position = '1'" :class="config.pageConfig.position == '1' ? 'active' : ''">
                    <img src="../../../../../../assets/app/other/banner/left.png" alt="" />
                </li>
                <li @click="config.pageConfig.position = '2'" :class="config.pageConfig.position == '2' ? 'active' : ''">
                    <img src="../../../../../../assets/app/other/banner/center.png" alt="" />
                </li>
            </ul>
        </div>
        <div class="divider"></div>
        <div class="func">
            <p class="attr">默认文字</p>
            <div class="adjust-item">
                <span>文字</span>
                <el-input v-model="config.pageConfig.searchWord" placeholder='请输入默认文字' maxlength="10" :show-word-limit="true" />
            </div>
        </div>
        <div class="divider"></div>
        <div class="func">
            <p class="attr">边距</p>
            <div class="adjust-item">
                <span>上边距</span>
                <el-slider v-model="config.pageConfig.marginTop" :min="0" :max="50" show-input size="small" />px
            </div>
            <div class="adjust-item">
                <span>下边距</span>
                <el-slider v-model="config.pageConfig.marginBottom" :min="0" :max="50" show-input size="small" />px
            </div>
        </div>
        <div class="divider"></div>
        <div class="func">
            <p class="attr">圆角设置</p>
            <div class="adjust-item">
                <span>上圆角</span>
                <el-slider :min="0" :max="20" v-model="config.pageConfig.radiusTop" show-input size="small" />px
            </div>
            <div class="adjust-item">
                <span>下圆角</span>
                <el-slider :min="0" :max="20" v-model="config.pageConfig.radiusBottom" show-input size="small" />px
            </div>
        </div>
        <div class="divider"></div>
    </div>
</template>

<script lang="ts">
export default {
    name: "SearchOperation",
};
</script>
<script lang="ts" setup>
import { reactive, onMounted } from "vue";
import TitleIcon from "@/assets/app/icon/search.png";
import OperationTitle
  from "@/views/activity/actApp/components/default/operationComponents/operationTitle/OperationTitle.vue";
const config = defineProps({
    pageConfig: {
        type: Object,
        default: {
            style:'3',
            borderColor:'#ededed',
            borderWidth:1,
            color:'',
            componentColor:'#f2f2f2',
            iconColor:'#fd463e',
            textColor:'#999999',
            position:'1',
            searchWord:'',
            marginTop:5,
            marginBottom:5,
            radiusTop:4,
            radiusBottom:4,
        },
    },
});
let emits = defineEmits<{ (e: "changeStyle", configStyle: Object): void }>();
watch(config, (val) => {
    emits("changeStyle", config.pageConfig);
});
</script>

<style lang="scss" scoped>
.title {
    padding: 8px 23px;
    overflow: hidden;
    border-bottom: 5px solid #f6f7f9;
    display: flex;
    position: relative;
    height: 50px;
    box-sizing: border-box;

    img {
        position: absolute;
        left: 0;
        top: -5px;
    }

    h5 {
        font-size: 16px;
        font-weight: 700;
        position: absolute;
        left: 70px;
        top: 0;
        line-height: 50px;
    }
}

.func {
    border-bottom: 5px solid #f6f7f9;
    padding: 20px 16px;
    font-size: 16px;

    .attr {
        line-height: 1;
        color: #47565d;
        font-weight: bolder;
        margin-bottom: 20px;

        span {
            font-size: 14px;
            font-weight: 400;
            color: red;
        }
    }

    ul.common-ul {
        list-style: none;
        display: flex;
        align-items: center;
        justify-content: center;

        li {
            flex: 1;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 4px 0 0 4px;
            border: 2px solid #ededed;
            border-collapse: collapse;

            &.active {
                border: 2px solid #fb6638;
            }

            img {
                max-width: 100% !important;
                max-height: 100% !important;
            }
        }
    }

    h4 {
        position: relative;
        padding: 8px 16px 8px 16px;
        border-radius: 6px;
        color: red;
        font-size: 16px;
        line-height: 22px;
        margin-bottom: 10px;
        border: 1px solid #d8e8fc;
        background-color: #e5f0fe;
    }

    div.adjust-item {
        display: flex;
        align-items: center;
        margin-top: 10px;
        margin-bottom: 10px;

        span {
            width: 64px;
            text-align: right;
            margin-right: 15px;
            color: #666;
        }

        :deep(.el-slider) {
            width: 240px;
            margin-right: 3px;
            margin-left: 15px;
        }

        :deep(.el-checkbox) {
            width: 100px;
            margin-right: 13px;
        }

        :deep(.el-color-picker) {
            margin-right: 13px;
        }

        :deep(.el-slider__runway.show-input) {
            margin-right: 15px;
        }

        :deep(.el-input-number) {
            width: 100px;
            background: #f4f3f7;
            border: 1px solid #f4f3f7;
        }
        .input-content {
            width: 200px;
        }
        .price-range{
            width: 150px;
        }
        .common-ul {
            width: 200px;
        }
    }

    .add-item {
        width: 100%;

        .add-item-input {
            background: #f4f3f7;
            border-radius: 4px;
            padding: 10px 20px 0px 10px;
            color: #999;
            //   margin-top: 10px;
            //   margin-bottom: 20px;
            position: relative;
            display: flex;

            p {
                width: 60px;
            }

            :deep(.el-input) {
                font-size: 12px;
                height: 30px;
                width: calc(100% - 60px);
            }

            &.extra-li {
                justify-content: center;
            }

            .link-div {
                width: calc(100% - 80px);
                display: flex;
                align-items: center;
                background: #e8effc;
                border: 0;
                padding-left: 16px;
                cursor: pointer;
                position: relative;

                :deep(.el-icon) {
                    margin-right: 10px;
                }

                :deep(.el-input) {
                    font-size: 12px;
                    height: 30px;
                    width: calc(100% - 30px);
                }

                .close-btn {
                    position: absolute;
                    right: 5px;
                }
            }

            .sure-close {
                position: absolute;
                right: 5px;
                top: 5px;
                cursor: pointer;
            }
        }
    }
}

.tips-rank {
    position: relative;
    padding: 8px 16px 8px 16px;
    border-radius: 6px;
    color: #666;
    font-size: 12px;
    line-height: 22px;
    margin-bottom: 10px;
    border: 1px solid #d8e8fc;
    background-color: #e5f0fe;
}

:deep(.el-radio__label) {
    font-size: 16px;
}

.img-placeholder {
    width: 80px;
    height: 80px;
    margin-bottom: 10px;
}

.upload-img {
    width: 80px;
    height: 80px;
    line-height: 80px;
    margin-right: 10px;
    border: 1px dashed #ededed;
    text-align: center;
    color: #dad9d9;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    float: left;
    position: relative;

    :deep(.el-image) {
        width: 80px;
        height: 80px;
    }

    &:hover {
        .upload-img_cover {
            opacity: 1;
        }
    }

    .upload-img_cover {
        opacity: 0;
        position: absolute;
        transition: all 0.3s ease;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.7);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-evenly;
    }
}

:deep(.el-upload-list) {
    width: 80px;
    height: 80px;
    margin-right: 10px;
}

:deep(.el-upload--picture-card) {
    width: 80px;
    height: 80px;
}
</style>
